package com.itheima.mapper.store;

import com.itheima.domain.store.Company;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CompanyMapper {

    //@Select("select * from st_company")
    List<Company> findAll();

    //新增企业
    @Insert("insert into st_company values(" +
            "#{id},#{name},#{expirationDate},#{address},#{licenseId}," +
            "#{representative},#{phone},#{companySize},#{industry},#{remarks}," +
            "#{state},#{city}" +
            ")")
    void addCompany(Company company);

    //通过id数组删除
    void deleteByIds(String[] idArr);


    //通过id查找企业
    Company findById(String id);


    //更新信息
    @Update("update st_company set " +
            "name=#{name},expiration_date=#{expirationDate},address=#{address},license_id=#{licenseId}," +
            "representative=#{representative},phone=#{phone},company_size=#{companySize},industry=#{industry},remarks=#{remarks}," +
            "state=#{state},city=#{city} where id=#{id}"
            )
    void updateCompany(Company company);
}
